package basic.tutorial.form;

import android.app.Activity;
import android.os.Bundle;
import android.view.ViewGroup.LayoutParams;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;

/*
 *  Clasa folosita pentru afisare.
 *  Exemplifica:
 *  	TableLayout
 *  	TableRow
 *  	TextView
 */

public class ViewForms extends Activity{
	
	// Clasa statica din care obtinem informatiile
	public static Entry books;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		
	     super.onCreate(savedInstanceState);
	     setContentView(R.layout.viewentry);  
	     int i;
	    
	     // Se face legatura cu tabelul
	     TableLayout tl = (TableLayout) findViewById(R.id.TableLayout01);
	     
	     // Pentru fiecare intrare in listele clasei statice 
	     for( i = 0; i < Entry.size(); i++ ){
	    	 // se creaza un rand(TableRow) nou, 
	    	 TableRow tr=new TableRow(this);
	    	 
	    	 TextView a = new TextView(this);
	    	 a.setText(Entry.getEntry(i).author);
	    	 a.setTextSize(17);
	    	 // se adauga informatiile(TextView) in obiectul de tip rand
	    	 tr.addView(a);
	    	 
	    	 TextView t = new TextView(this);
	    	 t.setText(Entry.getEntry(i).title);
	    	 t.setTextSize(15);
	    	 tr.addView(t);
	    	 
	    	 // se adauga randul in tablea
	    	 tl.addView(tr,new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
	     }
	     
	}
}
